*** /tmp/,RCSt1a27309	Thu Aug 24 00:02:48 1989
--- Makefile.rs.root	Wed Aug 23 22:56:27 1989
***************
*** 1,6 ****
  #
  # Makefile for HCJ rs232 + screen + mouse + ptrace + newflop + wantformat
! # root on wini (on dev 3,2 in my case)
  #
  CROSSDIR = /dsrg/bammi/cross-minix
  CROSSLIB = $(CROSSDIR)/lib
--- 1,6 ----
  #
  # Makefile for HCJ rs232 + screen + mouse + ptrace + newflop + wantformat
! # root on wini (on dev 3,2 in my case) bigger cache buf
  #
  CROSSDIR = /dsrg/bammi/cross-minix
  CROSSLIB = $(CROSSDIR)/lib
***************
*** 9,15 ****
  LD	= $(CROSSLIB)/gcc-ld
  l	= $(CROSSLIB)
  DEFS	= -DKERNEL -DWANTDISKROOT -DWANT_HCJ_RS232 -DWANTSCREEN \
! -DWANTMOUSE -DWANTPTRACE -DWANTNEWFLOP -DWANTFORMAT
  
  CFLAGS	= -O -Wall -DATARI_ST $(DEFS) -I. -I../h -mshort \
  	-fomit-frame-pointer -fcombine-regs
--- 9,15 ----
  LD	= $(CROSSLIB)/gcc-ld
  l	= $(CROSSLIB)
  DEFS	= -DKERNEL -DWANTDISKROOT -DWANT_HCJ_RS232 -DWANTSCREEN \
! -DWANTMOUSE -DWANTPTRACE -DWANTNEWFLOP -DWANTFORMAT -DBIGGER_BUF
  
  CFLAGS	= -O -Wall -DATARI_ST $(DEFS) -I. -I../h -mshort \
  	-fomit-frame-pointer -fcombine-regs
*** /tmp/,RCSt1a27309	Thu Aug 24 00:02:49 1989
--- buf.h	Sat Aug 19 00:56:19 1989
***************
*** 59,64 ****
--- 59,65 ----
  /* When a block is released, the type of usage is passed to put_block(). */
  #define WRITE_IMMED        0100	/* block should be written to disk now */
  #define ONE_SHOT           0200	/* set if block not likely to be needed soon */
+ #if 0
  #define INODE_BLOCK        0 + WRITE_IMMED		 /* inode block */
  #define DIRECTORY_BLOCK    1 + WRITE_IMMED		 /* directory block */
  #define INDIRECT_BLOCK     2 + WRITE_IMMED		 /* pointer block */
***************
*** 65,69 ****
--- 66,78 ----
  #define I_MAP_BLOCK        3 + WRITE_IMMED + ONE_SHOT	 /* inode bit map */
  #define ZMAP_BLOCK         4 + WRITE_IMMED + ONE_SHOT	 /* free zone map */
  #define ZUPER_BLOCK        5 + WRITE_IMMED + ONE_SHOT	 /* super block */
+ #else
+ #define INODE_BLOCK        0 		 /* inode block */
+ #define DIRECTORY_BLOCK    1 		 /* directory block */
+ #define INDIRECT_BLOCK     2 		 /* pointer block */
+ #define I_MAP_BLOCK        3 + WRITE_IMMED + ONE_SHOT	 /* inode bit map */
+ #define ZMAP_BLOCK         4 + WRITE_IMMED + ONE_SHOT	 /* free zone map */
+ #define ZUPER_BLOCK        5 + WRITE_IMMED + ONE_SHOT	 /* super block */
+ #endif
  #define FULL_DATA_BLOCK    6		 	 	 /* data, fully used */
  #define PARTIAL_DATA_BLOCK 7 				 /* data, partly used */
*** /tmp/,RCSt1a27309	Thu Aug 24 00:02:51 1989
--- cache.c	Wed Aug 23 23:17:12 1989
***************
*** 87,94 ****
--- 87,143 ----
  		}
    }
  
+ #if 0
    /* If the  block taken is dirty, make it clean by rewriting it to disk. */
    if (bp->b_dirt == DIRTY && bp->b_dev != NO_DEV) rw_block(bp, WRITING);
+ #else
+   /* write all the dirty blocks of this device,
+      (this idea thanks to bruce evans)
+      update: incorporated elevator algorithm
+      	     to write all dirty blocks
+      	     ++jrb
+    */
+   if (bp->b_dirt == DIRTY && bp->b_dev != NO_DEV)
+   {
+       register struct buf *flbp;
+       register block_nr   cb;
+       register short	  all_not_done;
+       
+       do 
+       {
+ 	  /* elevate from lower to higher blocks */
+ 	  for (flbp = front, all_not_done = 0, cb = (block_nr)0; flbp;
+ 	       flbp = flbp->b_next) 
+ 	  {
+ 	      if (flbp->b_dev == bp->b_dev && flbp->b_dirt == DIRTY)
+ 		  if(flbp->b_blocknr >= cb)
+ 		  {
+ 		      rw_block(flbp, WRITING);
+ 		      cb = flbp->b_blocknr;
+ 		  }
+ 		  else
+ 		      all_not_done++;
+ 	  }
+ 	  if(all_not_done > 0)
+ 	  {
+ 	      /* elevate down  from higher to lower blocks */
+ 	      for (flbp = front, all_not_done = 0; flbp; flbp = flbp->b_next)
+ 	      {
+ 		  if (flbp->b_dev == bp->b_dev && flbp->b_dirt == DIRTY)
+ 		      if(flbp->b_blocknr < cb)
+ 		      {
+ 			  rw_block(flbp, WRITING);
+ 			  cb = flbp->b_blocknr;
+ 		      }
+ 		      else
+ 			  all_not_done++;
+ 	      }
+ 	  }
+       } while (all_not_done > 0); /* keep doing until all dirty blocks on */
+ 				  /* device are written */
+       
+   }
+ #endif
  
    /* Fill in block's parameters and add it to the hash chain where it goes. */
    bp->b_dev = dev;		/* fill in device number */
*** /tmp/,RCSt1a27309	Thu Aug 24 00:02:52 1989
--- const.h	Wed Aug 23 22:55:47 1989
***************
*** 8,15 ****
  # define NR_BUFS           60	/* # blocks in the buffer cache */
  # define NR_BUF_HASH       64	/* size of buf hash table; MUST BE POWER OF 2*/
  #else
! # define NR_BUFS           20	/* # blocks in the buffer cache */
! # define NR_BUF_HASH       32	/* size of buf hash table; MUST BE POWER OF 2*/
  #endif
  #define NR_FDS            20	/* max file descriptors per process */
  #define NR_FILPS          64	/* # slots in filp table */
--- 8,20 ----
  # define NR_BUFS           60	/* # blocks in the buffer cache */
  # define NR_BUF_HASH       64	/* size of buf hash table; MUST BE POWER OF 2*/
  #else
! #  ifdef BIGGER_BUF
! #   define NR_BUFS           40	/* # blocks in the buffer cache */
! #   define NR_BUF_HASH       64	/* size of buf hash table; MUST BE POWER OF 2*/
! # else
! #   define NR_BUFS           20	/* # blocks in the buffer cache */
! #   define NR_BUF_HASH       32	/* size of buf hash table; MUST BE POWER OF 2*/
! # endif
  #endif
  #define NR_FDS            20	/* max file descriptors per process */
  #define NR_FILPS          64	/* # slots in filp table */
*** /tmp/,RCSt1a27309	Thu Aug 24 00:03:15 1989
--- pipe.c	Sat Aug 19 02:37:51 1989
***************
*** 29,34 ****
--- 29,35 ----
  #include "glo.h"
  #include "inode.h"
  #include "param.h"
+ #include "dev.h"
  #include "fs_proto.h"
  
  PRIVATE message mess;
***************
*** 309,317 ****
  	dev = f->filp_ino->i_zone[0];	/* device on which proc is hanging */
  	mess.TTY_LINE = (dev >> MINOR) & BYTE;
  	mess.PROC_NR = proc_nr;
! /* ++ */	mess.COUNT = f->filp_mode;	/* tell kernel whether R or W */
  	mess.m_type = CANCEL;
  	rw_dev(task, &mess);
  	revive(proc_nr, EINTR);	/* signal interrupted call */
    }
  
--- 310,325 ----
  	dev = f->filp_ino->i_zone[0];	/* device on which proc is hanging */
  	mess.TTY_LINE = (dev >> MINOR) & BYTE;
  	mess.PROC_NR = proc_nr;
! #if 0
! 	mess.COUNT = f->filp_mode;	/* tell kernel whether R or W */
  	mess.m_type = CANCEL;
  	rw_dev(task, &mess);
+ #else
+ 	/* Tell kernel whether R or W. Mode is from current call, not open. */
+ 	mess.COUNT = (rfp->fp_fd & BYTE) == READ ? R_BIT : W_BIT;
+ 	mess.m_type = CANCEL;
+ 	(*dmap[(dev >> MAJOR) & BYTE].dmap_rw)(task, &mess);
+ #endif
  	revive(proc_nr, EINTR);	/* signal interrupted call */
    }
  
***************
*** 325,333 ****
  		dev = f->filp_ino->i_zone[0];	/* device on which proc is hanging */
  		mess.TTY_LINE = (dev >> MINOR) & BYTE;
  		mess.PROC_NR = proc_nr;
! /* ++ */	mess.COUNT = f->filp_mode;	/* tell kernel whether R or W */
  		mess.m_type = CANCEL;
  		rw_dev(task, &mess);
  	}
  	rfp->fp_suspended = NOT_SUSPENDED;
  	reply(proc_nr, EINTR);	/* signal interrupted call */
--- 333,349 ----
  		dev = f->filp_ino->i_zone[0];	/* device on which proc is hanging */
  		mess.TTY_LINE = (dev >> MINOR) & BYTE;
  		mess.PROC_NR = proc_nr;
! #if 0	/* this bugfix from bruce evans */
! 		mess.COUNT = f->filp_mode;  /* tell kernel whether R or W */
  		mess.m_type = CANCEL;
  		rw_dev(task, &mess);
+ #else
+ 	/* Tell kernel whether R or W. Mode is from current call, not open. */
+ 	mess.COUNT = (rfp->fp_fd & BYTE) == READ ? R_BIT : W_BIT;
+ 	mess.m_type = CANCEL;
+ 	(*dmap[(dev >> MAJOR) & BYTE].dmap_rw)(task, &mess);
+ #endif
+ 
  	}
  	rfp->fp_suspended = NOT_SUSPENDED;
  	reply(proc_nr, EINTR);	/* signal interrupted call */
